package com.aaa.controller;

import com.aaa.pojo.Menu;
import com.aaa.service.MenuService;
import com.aaa.pojo.DefaultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 其他通用的控制器
 */
@RestController
@RequestMapping("/index")
public class IndexController {


    @Autowired
    private MenuService menuService;

    /**
     * 跟据用户id获取菜单
     *
     * @param id 用户id
     * @return 返回一个菜单集合
     */
    @PostMapping("/findMenuById")
    public List<Menu> findMenuByUid(Integer id) {
        return menuService.findMenuByUid(id);
    }

    /**
     * 退出登录成功之后调用的路径
     *
     * @return
     */
    @RequestMapping("/logoutSuccess")
    public DefaultMsg logoutSuccess() {
        return new DefaultMsg(200, 1, null, null);
    }
}
